﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Dala.Utilities
{
   public class SessionManager
    {

        public static Int32 _LOGGEDIN_USER_ID
        {
            get
            {
                if (HttpContext.Current.Session["_LOGGEDIN_USER_ID"] != null)
                {
                    return Convert.ToInt32(HttpContext.Current.Session["_LOGGEDIN_USER_ID"]);
                }
                else
                {
                    return -1;
                }
            }
            set
            {
                HttpContext.Current.Session["_LOGGEDIN_USER_ID"] = value;
            }
        }
        public static String _LOGGEDIN_USER_EMAIL
        {
            get
            {
                if (HttpContext.Current.Session["_LOGGEDIN_USER_EMAIL"] != null)
                {
                    return HttpContext.Current.Session["_LOGGEDIN_USER_EMAIL"].ToString();
                }
                else
                {
                    return string.Empty;
                }
            }
            set
            {
                HttpContext.Current.Session["_LOGGEDIN_USER_EMAIL"] = value;
            }
        }
        public static String _LOGGEDIN_USER_NAME
        {

            get
            {
                if (HttpContext.Current.Session["_LOGGEDIN_USER_NAME"] != null)
                {
                    return HttpContext.Current.Session["_LOGGEDIN_USER_NAME"].ToString();
                }
                else
                {
                    return string.Empty;
                }

            }
            set
            {
                HttpContext.Current.Session["_LOGGEDIN_USER_NAME"] = value;
            }

        }
        public static String _LOGGEDIN_USER_ROLE
        {

            get
            {
                if (HttpContext.Current.Session["_LOGGEDIN_USER_ROLE"] != null)
                {
                    return HttpContext.Current.Session["_LOGGEDIN_USER_ROLE"].ToString();
                }
                else
                {
                    return string.Empty;
                }

            }
            set
            {
                HttpContext.Current.Session["_LOGGEDIN_USER_ROLE"] = value;
            }

        }
        public static Boolean? _IS_AUTHENTICATED
        {

            get
            {
                if (HttpContext.Current.Session["IS_AUTHENTICATED"] != null)
                {
                    return Convert.ToBoolean(HttpContext.Current.Session["IS_AUTHENTICATED"].ToString());
                }
                else
                {
                    return false;
                }

            }
            set
            {
                HttpContext.Current.Session["IS_AUTHENTICATED"] = value;
            }

        }

        public static Boolean _IS_SEARCH
        {

            get
            {
                if (HttpContext.Current.Session["_IS_SEARCH"] != null)
                {
                    return Convert.ToBoolean(HttpContext.Current.Session["_IS_SEARCH"].ToString());
                }
                else
                {
                    return false;
                }

            }
            set
            {
                HttpContext.Current.Session["_IS_SEARCH"] = value;
            }

        }
        public static String _STATE
        {

            get
            {
                if (HttpContext.Current.Session["_STATE"] != null)
                {
                    return HttpContext.Current.Session["_STATE"].ToString();
                }
                else
                {
                    return string.Empty;
                }

            }
            set
            {
                HttpContext.Current.Session["_STATE"] = value;
            }

        }

        public static Int32 _CURRENT_PAGE
        {
            get
            {
                if (HttpContext.Current.Session["_CURRENT_PAGE"] != null)
                {
                    return Convert.ToInt32(HttpContext.Current.Session["_CURRENT_PAGE"]);
                }
                else
                {
                    return 0;
                }
            }
            set
            {
                HttpContext.Current.Session["_CURRENT_PAGE"] = value;
            }
        }

        public static Int32 _CURRENT_PAGE_MAX_NUM
        {
            get
            {
                if (HttpContext.Current.Session["_CURRENT_PAGE_MAX_NUM"] != null)
                {
                    return Convert.ToInt32(HttpContext.Current.Session["_CURRENT_PAGE_MAX_NUM"]);
                }
                else
                {
                    return 0;
                }
            }
            set
            {
                HttpContext.Current.Session["_CURRENT_PAGE_MAX_NUM"] = value;
            }
        }
        public static Int32 _CURRENT_QUERY_STRING_ID
        {
            get
            {
                if (HttpContext.Current.Request.QueryString["id"] != null)
                {
                    return Convert.ToInt32(HttpContext.Current.Request.QueryString["id"] as string);
                }
                else
                {
                    return -1;
                }
            }
            set
            {
                HttpContext.Current.Session["_CURRENT_PAGE_MAX_NUM"] = value;
            }
        }
        public static Int32? _AllCount
        {
            get
            {
                if (HttpContext.Current.Session["_AllCount"] != null)
                {
                    return Convert.ToInt32(HttpContext.Current.Session["_AllCount"]);
                }
                else
                {
                    return null;
                }
            }
            set
            {
                HttpContext.Current.Session["_AllCount"] = value;
            }
        }
    }
}
